﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RecuperateCondationSumirise.aspx.cs"
    Inherits="GH.Web.Welfare.RecuperateCondationSumirise" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>欢迎使用工会管理系统</title>
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            font-size: 16px;
            font-weight: bold;
        }
        .style2
        {
            height: 20px;
        }
    </style>
    <style type='text/css'>
        thead
        {
            font-size: 12pt;
            font-weight: bold;
            color: #444;
        }
        tbody
        {
            font-size: 10pt;
            color: #444;
        }
        td, th
        {
            border: solid 1px #E6E6E6;
            padding-left: 0px;
        }
        th
        {
            background-color: #5B8;
        }
        .alternation
        {
            background-color: #D2FFD2;
        }
        .alternation3
        {
            background-color: #DDEEDD;
        }
        .selected
        {
            background-color: #B3E1A3;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="../css/css.css" />
    <link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.7.2.custom.css" />
    <link rel="stylesheet" type="text/css" href="../JqueryUI/themes/ui-lightness/jquery-ui-1.7.2.custom.css" />
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/calendar.css" />

    <script type="text/javascript" src="../javascript/jquery-1.3.2.js"></script>

    <script type="text/javascript" src="../javascript/jquery-ui-1.7.2.custom.js"></script>

    <script type="text/javascript" src="../javascript/messageBox.js"></script>

    <script type="text/javascript" src="../javascript/formValidator.js"></script>

    <script type="text/javascript" src="../javascript/formValidatorRegex.js"></script>

    <script type="text/javascript" src="../javascript/Public.js"></script>

    <script type="text/javascript" src="../javascript/jquery-calendar.js"></script>

    <script type="text/javascript" src="../javascript/cal.js"></script>

    <!-- BEGIN  Select带可输入的功能  BEGIN -->

    <script type='text/javascript'>
        //定义 select 原值
        var oldValue, oldText;
        //select下拉框的onkeydown事件，修改下拉框的值
        function catch_keydown(sel) {
            switch (event.keyCode) {
                case 13: //回车键
                    event.returnValue = false;
                    break;
                case 27: //Esc键
                    sel.options[sel.selectedIndex].text = oldText;
                    sel.options[sel.selectedIndex].value = oldValue;
                    event.returnValue = false;
                    break;
                case 8:  //空格健
                    var s = sel.options[sel.selectedIndex].text;
                    s = s.substr(0, s.length - 1);
                    if (sel.options[0].value == sel.options[sel.selectedIndex].text) {
                        sel.options[sel.selectedIndex].value = s;
                        sel.options[sel.selectedIndex].text = s;
                    }
                    event.returnValue = false;
                    break;
            }
            if (!event.returnValue && sel.onchange)
                sel.onchange(sel)
        }

        //select下拉框的onkeypress事件，修改下拉框的值
        function catch_press(sel) {
            if (sel.selectedIndex == 0) {
                var s = sel.options[sel.selectedIndex].text + String.fromCharCode(event.keyCode);
                sel.options[sel.selectedIndex].value = s;
                sel.options[sel.selectedIndex].text = s;
                event.returnValue = false;
                if (!event.returnValue && sel.onchange)
                    sel.onchange(sel)
            }
        }

        //select下拉框的onfocus事件，保存下拉框原来的值
        function catch_focus(sel) {
            oldText = sel.options[sel.selectedIndex].value;
            oldValue = sel.options[sel.selectedIndex].value;
        }  
    </script>

    <!-- END    Select带可输入的功能  END-->
    <!-- BEGIN  画面的控制  BEGIN -->

    <script type='text/javascript'>
        $(document).ready(function() {


            /////////////////////////////////////////////////画面初始化//////////////////////////////////////////////
            //初始化数据

            // GetOrganizationSumirise("SELECT");
            //初始化权限
            SetInitialRights();
            InitData();
            /////////////////////////////////////////////////画面初始化//////////////////////////////////////////////

            /////////////////////////////////////////////////画面共通方法//////////////////////////////////////////////
            //权限设定
            function SetInitialRights() {
                //汇总权限
                if ($('#hddRights').val() != "1") {
                    $("#btnSummarys").css({ "display": "none" });

                }
                //查看其它单位权限
                if ($('#hddOpen').val() != "1") {
                    $("#btnOpen").css({ "display": "none" });

                }



            }
            //追加行常量
            function SetRowValue(strValue1, strValue2, strValue3, strValue4, strValue5, strValue6, strValue7, strValue8, strValue9) {
                var strRowAdd = "<tr><td align='center' width='40px'>a1</td><td align='center' style='display:none;'>a2</td><td align='center' width='200px'>a3</td><td align='center' width='240px'>a4</td><td align='center' width='120px'>a5</td><td align='center' width='120px'>a6</td><td align='left'>a7</td><td align='center'  style='display:none;'>a8</td><td align='center'  style='display:none;'>a9</td></tr>";
                return strRowAdd.replace("a1", strValue1).replace("a2", strValue2).replace("a3", strValue3).replace("a4", strValue4).replace("a5", strValue5).replace("a6", strValue6).replace("a7", strValue7).replace("a8", strValue8).replace("a9", strValue9);
            }


            //追加行数据
            function SetAddRowDataValue(RowNo) {
                var strRemark = " ";
                var UninonId = $("#hddUnionID").val();
                //                return SetRowValue(RowNo,"",SetSelectValue(GetVipMemberList(UninonId), ""), SetDisEditSelectValue(GetSexList()), SetInputDefaultValue("", 2), SetSelectValue(GetVipMemberList(UninonId), ""), SetSelectValue(GetVipMemberList(UninonId), ""), SetSelectValue(GetVipMemberList(UninonId), ""), SetInputDefaultValue("", 10), SetInputDefaultValue("", 30));
                return SetRowValue(
                RowNo, //序号
                $("#lblUnion").val(), //单位名称
                SetSelectValue(GetVipMemberList(UninonId), ""), //姓名
                SetInputDefaultValue("", 10), //参加工作时间
                SetInputDefaultValue("", 10), //享受标准
                SetInputDefaultValue("", 10), //疗养时间
                SetInputDefaultValue("", 10), //备注
                $("#hddUnionID").val(), //单位编号
                "0"); //单位编号
            }


            //对应业务信息
            function GetOrganizationSumirise(RightsFlg, theDate) {

                //清空明细显示
                $("#example>tbody>tr").each(function(i, item) {
                    if (i > 0) {
                        $(this).remove();
                    }
                });
                //明细赋值
                var strStrHtml = "";
                var queryString = "time=" + new Date() + "&TransFlg=RecuperateCondationSumirise" + "&RightsFlg=" + RightsFlg + "&theDate=" + theDate;
                $.ajax
                    ({
                        async: false,
                        type: "post", //ajax请求方式
                        url: "../ajaxGetJason.aspx", //请求服务器地址
                        datatype: "json", //希望数据库返回的数据类型
                        data: queryString, //发送给服务器的数据
                        processData: false, //阻止数据被自动转换为url编码
                        success: function(data) {//请求成功则调用该函数
                            var temp = eval(data);
                            if (temp) {
                                $.each(temp, function(i, item) {
                                    var strTr = "<tr style='height: 22px;'><td align='center' width='40px'>" + (i + 1)
                                             + "</td><td align='center' style='display:none;'>" + item["单位名称"]
                                              + "</td><td align='center' width='200px'>" + item["姓名"]
                                              + "</td><td align='center' width='240px'>" + item["参加工作时间"]
                                              + "</td><td align='center' width='120px'>" + item["享受标准"]
                                              + "</td><td align='center' width='120px'>" + item["疗养时间"]
                                              + "</td><td align='left'>" + item["备注"]
                                              + "</td><td align='center' style='display:none;'>" + item["单位"]
                                              + "</td><td align='center' style='display:none;'>" + item["No"]
                                              + "</td></tr> "

                                    strStrHtml += strTr;
                                });
                                $("#example").append(strStrHtml);
                            } else {
                                if (RightsFlg == "SELECT") {
                                    var tr_id = $("#example>tbody>tr:last").find("td:eq(0)").text();
                                    if ($.trim(tr_id) == "序号" || $.trim(tr_id) == "") {
                                        tr_id = 0;
                                    }
                                    var id = parseInt(tr_id) + 1;
                                    $("#example").append(SetAddRowDataValue(id));

                                    AddRowEvent(id); //添加事件
                                } else {

                                    alert("没有找到相关数据");
                                }
                            }
                        }
                    });
            }


            function AddRowEvent(intRowNo) {

                //参加工作时间
                $("#example>tbody>tr:eq(" + intRowNo + ")").find("td:eq(3)").find('input').simpleDatepicker({ startdate: 1920, enddate: 2050 });

                //疗养时间
                $("#example>tbody>tr:eq(" + intRowNo + ")").find("td:eq(5)").find('input').simpleDatepicker({ startdate: 1920, enddate: 2050 });


            }
            /////////////////////////////////////////////////画面共通方法//////////////////////////////////////////////
            function InitData() {
                var queryString = "";
                var theDate = $("#hddYear").val();
                var UnionID = $("#hddUnionID").val();

                var UpdateFlg = btnName; //操作区分，更新或者新规
                var FormFlg = "RecuperateCondationSumirise"; //处理画面区分，对应不同的后台业务处理
                queryString = "FormFlg=" + FormFlg
                                + "&UpdateFlg=" + UpdateFlg
                                + "&UnionID=" + UnionID//单位编号
                                + "&strName=" + theDate//年份
                                 + "&id=" + ""//无用


                $.ajax
                        ({
                            async: false,
                            type: "post", //ajax请求方式
                            url: "../AjaxExist.aspx", //请求服务器地址
                            datatype: "json", //希望数据库返回的数据类型
                            data: queryString, //发送给服务器的数据
                            processData: false, //阻止数据被自动转换为url编码
                            success: function(data) {//请求成功则调用该函数
                                if (data == "0") {
                                    //                                   alert("记录不存在!");
                                    //                                    var submitForm = document.getElementById("mainForm");
                                    //                                    submitForm.submit();
                                }
                                else {
                                    var beginTime = parseInt(data);
                                    $("#spBegin").text(beginTime);
                                    $("#spEnd").text("～" + (beginTime + 4));

                                    GetOrganizationSumirise("SELECT", beginTime);

                                    var queryString = "";
                                    var FormFlg = "SelectCurrentYear"; //处理画面区分，对应不同的后台业务处理
                                    queryString = "FormFlg=" + FormFlg
                                    + "&UpdateFlg=" + "Update"
                                    + "&Id=" + beginTime;
                                    $(this).dialog('close');
                                    $.ajax
                                    ({
                                        async: false,
                                        type: "post", //ajax请求方式
                                        url: "../ajaxUpdate.aspx", //请求服务器地址
                                        datatype: "json", //希望数据库返回的数据类型
                                        data: queryString, //发送给服务器的数据
                                        processData: false, //阻止数据被自动转换为url编码
                                        success: function(data) {//请求成功则调用该函数
                                            if (data == "OK") {
                                                window.close();
                                            } else {
                                                window.close();
                                            }
                                        }
                                    });
                                }
                            }
                        });
            }

            //处理区分
            var btnName = "";
            function createQueryString() {
                var queryString = "";
                var theDate = $("#txtDate").val();
                var UnionID = $("#hddUnionID").val();

                var UpdateFlg = btnName; //操作区分，更新或者新规
                var FormFlg = "RecuperateCondationSumirise"; //处理画面区分，对应不同的后台业务处理
                queryString = "FormFlg=" + FormFlg
                                + "&UpdateFlg=" + UpdateFlg
                                + "&UnionID=" + UnionID//单位编号
                                + "&strName=" + theDate//年份
                                 + "&id=" + ""//无用

                return queryString;
            }

            function Update(operflg) {
                var addValid = false; //插入操作是否成功flg
                var beginTime = 0;
                $.ajax
                        ({
                            async: false,
                            type: "post", //ajax请求方式
                            url: "../AjaxExist.aspx", //请求服务器地址
                            datatype: "json", //希望数据库返回的数据类型
                            data: createQueryString(), //发送给服务器的数据
                            processData: false, //阻止数据被自动转换为url编码
                            success: function(data) {//请求成功则调用该函数
                                if (data == "0") {
                                    //                                   alert("记录不存在!");
                                    //                                    var submitForm = document.getElementById("mainForm");
                                    //                                    submitForm.submit();
                                    beginTime = parseInt($("#txtDate").val());
                                    $("#spBegin").text(beginTime);
                                    $("#spEnd").text("年～" + (beginTime + 4) + "年");
                                    var tr_id = $("#example>tbody>tr:last").find("td:eq(0)").text();
                                    if ($.trim(tr_id) == "序号" || $.trim(tr_id) == "") {
                                        tr_id = 0;
                                    }
                                    var id = parseInt(tr_id) + 1;
                                    $("#example").append(SetAddRowDataValue(id));

                                    AddRowEvent(id); //添加事件

                                }
                                else {
                                    beginTime = parseInt(data);
                                    $("#spBegin").text(beginTime);
                                    $("#spEnd").text("年～" + (beginTime + 4) + "年");

                                    GetOrganizationSumirise("SELECT", beginTime)
                                }
                            }
                        });
                return addValid;
            };
            /////////////////////////////////////////////////画面事件//////////////////////////////////////////////
            //追加鼠标事件 行选择
            $('tbody > tr', $('#example')).live("click", function() {
                $('.selected').removeClass('selected');
                $(this).addClass('selected'); //this 表示引发事件的对象，但它不是 jquery 对象
                var tr_id = $(this).find("td:eq(0)").text();
                //对隐藏控件设定当前行的值
                $('#txtRowNo').val(tr_id);
            }).hover(		//注意这里的链式调用
					        function() {
					            $(this).addClass('mouseOver');
					        },
			        function() {
			            $(this).removeClass('mouseOver');
			        }
           );
            //行删除
            $('#btnDelete').click(function() {
                if ($.trim($('#txtRowNo').val()) == "") {
                    alert("请选择行");
                    return;
                }
                if (!window.confirm("请确认是否删除记录。 ")) {
                    return;
                }
                var rows = $('#txtRowNo').val();
                var theID = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(8)").text();

                if (theID == '0') {
                    $("#example>tbody>tr:eq(" + rows + ")").remove();
                    $('#txtRowNo').val("");

                } else {
                    var theDeleteString = "ID=" + theID //ID编号
                                       + "&UpdateFlg=" + "Update"
                                       + "&FormFlg=" + "RecuperateCondationSumirise";


                    $.ajax
            ({
                async: false,
                type: "post", //ajax请求方式
                url: "../AjaxDelete.aspx", //请求服务器地址
                datatype: "json", //希望数据库返回的数据类型
                data: theDeleteString, //发送给服务器的数据
                processData: false, //阻止数据被自动转换为url编码
                success: function(data) {//请求成功则调用该函数
                    if (data == "OK") {
                        $('#txtRowNo').val("");
                        $("#example>tbody>tr:eq(" + rows + ")").remove();
                    }
                    else {
                        alert("删除失败！")
                    }
                }
            });
                    var intRow = 1;
                    $("#example>tbody>tr").each(function(i, item) {
                        //跳过顶上的两行标题头
                        if (i > 0) {
                            //序号重新排序
                            $(this).find("td:eq(0)").text(intRow);
                            intRow++;
                        }
                    })
                }
            });

            //插入行
            $('#btnAdd').click(function() {


                var tr_id = $("#example>tbody>tr:last").find("td:eq(0)").text();
                if ($.trim(tr_id) == "序号" || $.trim(tr_id) == "") {
                    tr_id = 0;
                }
                var id = parseInt(tr_id) + 1;
                $("#example").append(SetAddRowDataValue(id));

                AddRowEvent(id); //添加事件
            });


            //插入行
            $('#btnNew').click(function() {
                btnName = "Add";

                $("#datepanle").dialog('open');
            });

            //行编辑
            $('#btnEdit').click(function() {
                if ($.trim($('#txtRowNo').val()) == "") {
                    alert("请选择行");
                    return;
                }
                var rows = $('#txtRowNo').val();
                //序号
                //单位
                //姓名
                editedContent2 = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(2)").text();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(2)").empty();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(2)").append(SetSelectValue(GetVipMemberList(GetUionListFirstId()), editedContent2));


                //参加工作时间
                editedContent3 = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(3)").text();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(3)").empty();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(3)").append(SetInputDefaultValue(editedContent3, 10));

                //享受标准
                editedContent4 = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(4)").text();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(4)").empty();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(4)").append(SetInputDefaultValue(editedContent4, 10));

                //疗养时间
                editedContent5 = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(5)").text();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(5)").empty();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(5)").append(SetInputDefaultValue(editedContent5, 10));

                //备注
                editedContent6 = $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(6)").text();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(6)").empty();
                $("#example>tbody>tr:eq(" + rows + ")").find("td:eq(6)").append(SetInputDefaultValue(editedContent6, 50));


                //添加事件
                AddRowEvent(rows);
                editedID = rows;
            });

            /// <summary>
            /// <p><b>方法名：</b>CreateUpdateString</p>
            /// <p><b>概要説明:</b>ajax向后台传的参数，区分ID和子区分ID</p>
            /// <p><b>作者  :</b>程明亮</p>
            /// <p><b>日期  :</b>2009/07/24</p>
            /// <p><b>修正履历:</b></p>
            /// </summary>
            function CreateUpdateString() {
                var no = "";
                //单位

                var unionID = "";
                //姓名
                var vipName = "";

                //年份
                var theYear = $("#spBegin").text();

                //参加工作时间
                var workbegintime = "";

                //享受标准
                var enjoystandard = "";

                //疗养时间
                var recuperationtime = "";

                //备注
                var Remark = ""


                $("#example").find("tr:not(:eq(0))").each(function() {

                    if ($(this).find('td:eq(2)').find('select').length > 0) {

                        //姓名                   
                        if ($(this).find('td:eq(2)').find('select').length > 0) {
                            vipName = vipName + $(this).find('td:eq(2)').find('select').val() + ",";

                        }
                        else {
                            vipName = vipName + $(this).find('td:eq(2)').text() + ",";
                        }


                        //参加工作时间
                        if ($(this).find('td:eq(3)').find('input').length > 0) {
                            workbegintime = workbegintime + $(this).find('td:eq(3)').find('input').val() + ",";
                        }
                        else {
                            workbegintime = workbegintime + $(this).find('td:eq(3)').text() + ",";
                        }

                        //享受标准
                        if ($(this).find('td:eq(4)').find('input').length > 0) {
                            enjoystandard = enjoystandard + $(this).find('td:eq(4)').find('input').val() + ",";
                        }
                        else {
                            enjoystandard = enjoystandard + $(this).find('td:eq(4)').text() + ",";
                        }

                        //疗养时间
                        if ($(this).find('td:eq(5)').find('input').length > 0) {
                            recuperationtime = recuperationtime + $(this).find('td:eq(5)').find('input').val() + ",";
                        }
                        else {
                            recuperationtime = recuperationtime + $(this).find('td:eq(5)').text() + ",";
                        }





                        //备注
                        if ($(this).find('td:eq(6)').find('input').length > 0) {
                            Remark = Remark + $(this).find('td:eq(6)').find('input').val() + ",";
                        }
                        else {
                            Remark = Remark + $(this).find('td:eq(6)').text() + ",";
                        }
                        unionID = unionID + $(this).find('td:eq(7)').text() + ",";

                        no = no + $(this).find('td:eq(8)').text() + ",";
                    }

                })

                var queryString = "Union=" + unionID
                               + "&no=" + no
                               + "&vipName=" + vipName
                               + "&theYear=" + theYear
                               + "&workbegintime=" + workbegintime
                               + "&enjoystandard=" + enjoystandard
                               + "&recuperationtime=" + recuperationtime
                              + "&Remark=" + Remark
                              + "&UpdateFlg=" + "Update"
                              + "&FormFlg=" + "RecuperateCondationSumirise";
                return queryString;
            };

            //提交画面所有数据
            $('#btnSave').click(function() {
                if ($("#example").find("tr").length == 1) {
                    alert("没有可保存的数据！");
                    return;
                }

                $.ajax
            ({
                async: false,
                type: "post", //ajax请求方式
                url: "../ajaxUpdate.aspx", //请求服务器地址
                datatype: "json", //希望数据库返回的数据类型
                data: CreateUpdateString(), //发送给服务器的数据
                processData: false, //阻止数据被自动转换为url编码
                success: function(data) {//请求成功则调用该函数
                    if (data == "OK") {
                        alert("更新成功！");
                        var flog = "SELECT";
                        if ($("#hddSumarry").val() == "1") {
                            flog = "Summary";
                        }
                        GetOrganizationSumirise(flog, $("#spBegin").text());
                        //                        var submitForm = document.getElementById("mainForm");
                        //                        submitForm.submit();
                    }
                    else {
                        alert("更新失败！")
                    }
                }
            });

            });
            $("#datepanle").dialog({
                bgiframe: true,
                autoOpen: false,
                height: 150,
                modal: true,
                draggable: true,
                buttons: {
                    '提交': function() {

                        Update(btnName);
                        $("#hddSumarry").val("0")
                        var queryString = "";
                        var FormFlg = "SelectCurrentYear"; //处理画面区分，对应不同的后台业务处理
                        queryString = "FormFlg=" + FormFlg
                               + "&UpdateFlg=" + "Update"
                                + "&Id=" + $("#txtDate").val();
                        $(this).dialog('close');
                        $.ajax
                        ({
                            async: false,
                            type: "post", //ajax请求方式
                            url: "../ajaxUpdate.aspx", //请求服务器地址
                            datatype: "json", //希望数据库返回的数据类型
                            data: queryString, //发送给服务器的数据
                            processData: false, //阻止数据被自动转换为url编码
                            success: function(data) {//请求成功则调用该函数
                                if (data == "OK") {
                                    window.close();
                                } else {
                                    window.close();
                                }
                            }
                        });

                    },
                    '取消': function() {
                        $(this).dialog('close');
                    }
                },
                close: function() {
                    $("#txtDate").val("");
                }
            });

            //单位选择画面
            $('#btnOpen').click(function() {
                window.showModalDialog("RecuperateCondationDateDialog .aspx?Random=" + Math.random(), window, "dialogWidth:330px;dialogHeight:500px;status=no;help=no;scroll:no");
                var submitForm = document.getElementById("mainForm");
                submitForm.submit();
                //清空当前行号
                $('#txtRowNo').val("");
            });

            //汇总
            $('#btnSummarys').click(function() {
                GetOrganizationSumirise("Summary", $("#spBegin").text());
                //汇总区分
                $('#hddSumarry').val("1");
                $('#lblUnion').text($('#hddAllUnionName').val()); 
            });


            //打印
            $('#btnPrintView').click(function() {
                if ($("#example").find("tr").length == 1) {
                    alert("没有可打印的数据！");
                    return;
                }
                if ($('#hddSumarry').val() == "1") {
                    openwindow("RecuperateCondationPrint.aspx?Random=" + Math.random() + " &RightsFlg=" + "Summary", 'newwindow', 950, 500);
                }
                else {
                    openwindow("RecuperateCondationPrint.aspx?Random=" + Math.random() + " &RightsFlg=" + "SELECT", 'newwindow', 950, 500);
                }
            });

            $('#btnExcelExport').click(function() {
                if ($("#example").find("tr").length == 1) {
                    alert("没有可导出的数据！");
                    return;
                }

                if ($('#hddSumarry').val() == "1") {
                    window.open("../Common/ExcelExport.aspx?Random=" + Math.random() + "&TransFlg=RecuperateCondation" + "&Action=Summary", "win");
                }
                else {
                    window.open("../Common/ExcelExport.aspx?Random=" + Math.random() + "&TransFlg=RecuperateCondation" + "&Action=SELECT", "win");
                }

            });


            /////////////////////////////////////////////////画面事件//////////////////////////////////////////////


        });
	
    </script>

    <!-- END    画面的控制  END   -->
</head>
<body>
    <form id="mainForm" runat="server">
    <table width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <table width="99%" cellpadding="0" cellspacing="0" class="table">
                    <tr>
                        <td valign="top">
                            <table width="100%" class="top" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="height: 22px;">
                                        &nbsp;<b>当前位置:</b>&nbsp;<a href="#">职工福利</a>&nbsp;>>&nbsp;<a href="#">疗养情况统计表</a><input
                                            id="txtRowNo" type="text" style="display: none" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 5px">
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="middle" style="border: thin dotted #C0C0C0; background-color: #C5E5FC">
                            <img alt="" id="btnNew" src="../images/button/btnOpenAdd.gif" />
                            &nbsp;
                            <img alt="" id="btnOpen" src="../images/button/btnOpen.gif" />
                            &nbsp;
                            <img alt="" id="btnSave" src="../images/button/btnSave.gif" />
                            &nbsp;
                            <img alt="" id="btnPrintView" src="../images/button/btnPrint.gif" />
                            <!--&nbsp;
                            <img alt="" id="btnPrint" src="../images/button/btnPrintSet.gif" />-->
                            &nbsp;
                            <img alt="" id="btnAdd" src="../images/button/btnInsertRow.gif" />
                            &nbsp;
                            <img alt="" id="btnDelete" src="../images/button/btnDeleteRow.gif" />
                            &nbsp;
                            <img alt="" id="btnEdit" src="../images/button/btnEditRow.gif" />
                            &nbsp;
                            <img alt="" id="btnExcelExport" src="../images/button/btnExcelExport.gif" />
                            &nbsp;
                            <img alt="" id="btnSummarys" src="../images/button/btnSummary.gif" />
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 5px">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 30px" align="center" class="style1">
                            <%= UnitRoot %>职工疗休养情况统计表
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="float: left; margin-left: 2px">
                                单位：<asp:Label ID="lblUnion" runat="server" /><input id="hddUnionID" type="hidden"
                                    runat="server" />
                            </div>
                            <div style="float: right; margin-right: 2px">
                                周期 5 年 起始年份：<span id="spBegin"></span><span id="spEnd"></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <table id='example' style="width: 100%; border-collapse: collapse;">
                                <!--<thead style="text-align:center;" >-->
                                <tr>
                                    <th style="width: 40px; height: 44px; background-color: #B2DBF7;" align="center">
                                        序号
                                    </th>
                                    <th style="display: none" align="center">
                                        单位名称
                                    </th>
                                    <th style="width: 200px; height: 44px; background-color: #B2DBF7;" align="center">
                                        姓名
                                    </th>
                                    <th style="width: 240px; height: 44px; background-color: #B2DBF7;" align="center">
                                        参加工作时间
                                    </th>
                                    <th colspan="2" style="width: 240px; height: 44px; background-color: #B2DBF7;" align="center">
                                        <table width='100%' border="0">
                                            <tr>
                                                <th colspan="2" style="height: 22px; width: 240px; background-color: #B2DBF7;" align="center">
                                                    周期内
                                                </th>
                                            </tr>
                                            <tr>
                                                <th style="height: 22px; width: 120px; background-color: #B2DBF7;" align="center">
                                                    享受标准
                                                </th>
                                                <th style="height: 22px; width: 120px; background-color: #B2DBF7;" align="center">
                                                    疗养时间
                                                </th>
                                            </tr>
                                        </table>
                                    </th>
                                    <th style="height: 44px; background-color: #B2DBF7;" align="center">
                                        备注
                                    </th>
                                    <th align='center' style='display: none;'>
                                    </th>
                                    <th align='center' style='display: none;'>
                                    </th>
                                </tr>
                                <!--</thead>-->
                                <!--<tbody id='content'>-->
                                <!--</tbody>-->
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hddRights" runat="server" />
    <asp:HiddenField ID="hddSumarry" runat="server" />
    <asp:HiddenField ID="hddOpen" runat="server" />
    <asp:HiddenField ID="hddYear" runat="server" />
    <asp:HiddenField ID="hddAllUnionName" runat="server" />
    <div id="datepanle" title="开始年份">
        <fieldset>
            <div style="text-align: center; vertical-align: middle">
                <input id="txtDate" type="text" maxlength="4" />年&nbsp;<font color="red">*为四位数字</font></div>
        </fieldset>
    </div>

    <script type="text/javascript">
        $("#datepanle").hide();
    </script>

    </form>
</body>
</html>
